package com.example.demo01;

/**
 * 字符串反转
 */
public class Change {
    public static int count=0;
    public static void main(String[] args) {
        int n=1234;
        int arr[]=new int[String.valueOf(n).length()];
        myRevert(n,arr);
        for (int i = 0; i < 4; i++) {
            System.out.println(arr[i]);
        }
    }
    public static void myRevert(int n,int arr[]){
        if (n<10){
            arr[count++]=n;
        }else {
            arr[count++]=n%10;
            myRevert(n/10,arr);
        }
    }
}
